/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.vale.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Gabriel Bran gbran.u@gmail.com
 */
@Entity
@Table(name = "evaluation")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Evaluation.findAll", query = "SELECT e FROM Evaluation e"),
    @NamedQuery(name = "Evaluation.findByIdEva", query = "SELECT e FROM Evaluation e WHERE e.idEva = :idEva"),
    @NamedQuery(name = "Evaluation.findByFiscalYear", query = "SELECT e FROM Evaluation e WHERE e.fiscalYear = :fiscalYear"),
    @NamedQuery(name = "Evaluation.findByDateEva", query = "SELECT e FROM Evaluation e WHERE e.dateEva = :dateEva"),
    @NamedQuery(name = "Evaluation.findByIdInter", query = "SELECT e FROM Evaluation e WHERE e.idInter = :idInter"),
    @NamedQuery(name = "Evaluation.findByNParticipant", query = "SELECT e FROM Evaluation e WHERE e.nParticipant = :nParticipant"),
    @NamedQuery(name = "Evaluation.findByModule", query = "SELECT e FROM Evaluation e WHERE e.module = :module")})
public class Evaluation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_eva")
    private Integer idEva;
    @Size(max = 15)
    @Column(name = "fiscal_year")
    private String fiscalYear;
    @Basic(optional = false)
    @NotNull
    @Column(name = "date_eva")
    @Temporal(TemporalType.DATE)
    private Date dateEva;
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_inter")
    private int idInter;
    @Basic(optional = false)
    @NotNull
    @Column(name = "n_participant")
    private int nParticipant;
    @Basic(optional = false)
    @NotNull
    @Column(name = "module")
    private int module;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEva")
    private List<EvaluationForm> evaluationFormList;

    public Evaluation() {
    }

    public Evaluation(Integer idEva) {
        this.idEva = idEva;
    }

    public Evaluation(Integer idEva, Date dateEva, int idInter, int nParticipant, int module) {
        this.idEva = idEva;
        this.dateEva = dateEva;
        this.idInter = idInter;
        this.nParticipant = nParticipant;
        this.module = module;
    }

    public Integer getIdEva() {
        return idEva;
    }

    public void setIdEva(Integer idEva) {
        this.idEva = idEva;
    }

    public String getFiscalYear() {
        return fiscalYear;
    }

    public void setFiscalYear(String fiscalYear) {
        this.fiscalYear = fiscalYear;
    }

    public Date getDateEva() {
        return dateEva;
    }

    public void setDateEva(Date dateEva) {
        this.dateEva = dateEva;
    }

    public int getIdInter() {
        return idInter;
    }

    public void setIdInter(int idInter) {
        this.idInter = idInter;
    }

    public int getNParticipant() {
        return nParticipant;
    }

    public void setNParticipant(int nParticipant) {
        this.nParticipant = nParticipant;
    }

    public int getModule() {
        return module;
    }

    public void setModule(int module) {
        this.module = module;
    }

    @XmlTransient
    public List<EvaluationForm> getEvaluationFormList() {
        return evaluationFormList;
    }

    public void setEvaluationFormList(List<EvaluationForm> evaluationFormList) {
        this.evaluationFormList = evaluationFormList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEva != null ? idEva.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Evaluation)) {
            return false;
        }
        Evaluation other = (Evaluation) object;
        if ((this.idEva == null && other.idEva != null) || (this.idEva != null && !this.idEva.equals(other.idEva))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.vale.entity.Evaluation[ idEva=" + idEva + " ]";
    }
    
}
